const Mock = require('mockjs');
Mock.setup({ timeout: '200-600ms' }); // 响应延迟

// 自动加载所有mock模块
const files = require.context('.', true, /\.js$/);
files.keys().forEach(key => {
  if (key === './index.js') return;
  const module = files(key).default;
  for (const [path, data] of Object.entries(module)) {
    const [method, url] = path.split('|');
    Mock.mock(new RegExp(url), method?.toLowerCase(), data);
  }
});